package com.hypo.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.hypo.mapper.LogMapper;
import com.hypo.pojo.OperateLog;
import com.hypo.pojo.PageResult;
import com.hypo.service.LogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private LogMapper logMapper;

    @Override
    public PageResult page(Integer page, Integer pageSize) {
        PageHelper.startPage(page, pageSize);
        List<OperateLog> list = logMapper.page(page, pageSize);
        Page<OperateLog> operateLogPage = (Page<OperateLog>) list;
        return new PageResult(operateLogPage.getTotal(), list);
    }
}
